describe("MoveAmountController unit test for Indonesia with BillPayment", function() {
	var moveAmountController = null;
    var objE = {errorCode:'code', errorMessage:'message'};
    var transfer = null;
    beforeEach(function() {
		var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        transfer = App.BillPayment.create();
        var t_moveHolderCtrl = App.MoveHolderController.create();

        App.MoveAmountController.reopen({
            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
                this.set('controllers.moveHolder', t_moveHolderCtrl);
                this.set('transfer', transfer);
            }
        });
        spyOn(App.getSession(),'getCurrentTransfer').andReturn(transfer);
        moveAmountController = App.MoveAmountController.create();
    });

    it("prepareController", function(){
        spyOn(moveAmountController, 'showLoading');
        spyOn(moveAmountController, 'billPresentmentCallback');
        var transferResult = [];

        spyOn(App.api_transfer,'getBillPresentment').andCallFake(function(transferResult, callback) {
            callback(transferResult,objE);
        });

        moveAmountController.prepareController();
        expect(moveAmountController.showLoading).toHaveBeenCalled();
        expect(App.api_transfer.getBillPresentment).toHaveBeenCalled();
        expect(moveAmountController.billPresentmentCallback).toHaveBeenCalled();
    });

    it("billPresentmentCallback", function(){

        spyOn(moveAmountController, 'hasError').andReturn(false);
        spyOn(moveAmountController, 'hideLoading');

        moveAmountController.billPresentmentCallback([], objE);

        expect(moveAmountController.hasError).toHaveBeenCalledWith(objE);
        expect(moveAmountController.hideLoading).toHaveBeenCalled();
    });


});

describe("MoveAmountController unit test for Indonesia with OneTimeBillPayment", function() {
    var moveAmountController = null;
    var objE = {errorCode:'code', errorMessage:'message'};
    var transfer = null;
    beforeEach(function() {
        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        transfer = App.OneTimeBillPayment.create();
        var t_moveHolderCtrl = App.MoveHolderController.create();

        App.MoveAmountController.reopen({
            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
                this.set('controllers.moveHolder', t_moveHolderCtrl);
                this.set('transfer', transfer);
            }
        });
        spyOn(App.getSession(),'getCurrentTransfer').andReturn(transfer);
        moveAmountController = App.MoveAmountController.create();
    });

    it("prepareController", function(){
        spyOn(moveAmountController, 'showLoading');
        spyOn(moveAmountController, 'billPresentmentCallback');
        var transferResult = [];

        spyOn(App.api_transfer,'getBillPresentment').andCallFake(function(transferResult, callback) {
            callback(transferResult,objE);
        });

        moveAmountController.prepareController();
        expect(moveAmountController.showLoading).toHaveBeenCalled();
        expect(App.api_transfer.getBillPresentment).toHaveBeenCalled();
        expect(moveAmountController.billPresentmentCallback).toHaveBeenCalled();
    });

    it("billPresentmentCallback", function(){

        spyOn(moveAmountController, 'hasError').andReturn(false);
        spyOn(moveAmountController, 'hideLoading');

        moveAmountController.billPresentmentCallback([], objE);

        expect(moveAmountController.hasError).toHaveBeenCalledWith(objE);
        expect(moveAmountController.hideLoading).toHaveBeenCalled();
    });


});


describe("MoveAmountController unit test for Indonesia with TopUpPayment", function() {
    var moveAmountController = null;
    var objSelected = {value:'10'};
    var t_product ={
        "field": "Customer Number",
        "type": "NUMERIC",
        "required": true,
        "valueList": "304;000;0156;03",
        "lengthMax": 30
        };
    var transfer = null;
    beforeEach(function() {
        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        transfer = App.TopUpPayment.create({
                    payee: App.BillPaymentPayee.create({
                        biller:App.Biller.create({
                            billerValidations:[App.BillerValidation.create(t_product),App.BillerValidation.create(t_product),App.BillerValidation.create(t_product)]
                        })
                    })
                });

        var t_moveHolderCtrl = App.MoveHolderController.create();
        App.MoveAmountController.reopen({
            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
                this.set('controllers.moveHolder', t_moveHolderCtrl);
                this.set('transfer', transfer);
            }
        });
        spyOn(App.getSession(),'getCurrentTransfer').andReturn(transfer);
        moveAmountController = App.MoveAmountController.create();
    });

    it("prepareController", function(){
        moveAmountController.prepareController();
    });

    it("dropdownItemSelected", function(){
        moveAmountController.dropdownItemSelected(objSelected);
    });


});

describe("MoveAmountController unit test for Indonesia with OneTimeTopUpPayment", function() {
    var moveAmountController = null;
    var objSelected = {value:'10'};
    var t_product ={
        "field": "Customer Number",
        "type": "NUMERIC",
        "required": true,
        "valueList": "304;000;0156;03",
        "lengthMax": 30
    };
    var transfer = null;
    beforeEach(function() {
        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        transfer = App.OneTimeTopUpPayment.create({
            biller: App.BillPaymentPayee.create({
                    billerValidations:[App.BillerValidation.create(t_product),App.BillerValidation.create(t_product),App.BillerValidation.create(t_product)]
            })
        });

        var t_moveHolderCtrl = App.MoveHolderController.create();
        App.MoveAmountController.reopen({
            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
                this.set('controllers.moveHolder', t_moveHolderCtrl);
                this.set('transfer', transfer);
            }
        });
        spyOn(App.getSession(),'getCurrentTransfer').andReturn(transfer);
        moveAmountController = App.MoveAmountController.create();
    });

    it("prepareController", function(){
        moveAmountController.prepareController();
    });

    it("dropdownItemSelected", function(){
        moveAmountController.dropdownItemSelected(objSelected);
    });
});

describe("MoveAmountController unit test for Indonesia with OwnAccountTransfer", function() {
    var moveAmountController = null;
    var objE = {errorCode:'code', errorMessage:'message'};
    var transfer = null;
    beforeEach(function() {
        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        transfer = App.OwnAccountTransfer.create({
            fromAccount:Ember.Object.create({currencyCode:'ID'}),
            toAccount:Ember.Object.create({currencyCode:'USD'})
        });
        var t_moveHolderCtrl = App.MoveHolderController.create();

        App.MoveAmountController.reopen({
            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
                this.set('controllers.moveHolder', t_moveHolderCtrl);
                this.set('transfer', transfer);
            }
        });
        spyOn(App.getSession(),'getCurrentTransfer').andReturn(transfer);
        moveAmountController = App.MoveAmountController.create();
    });

    it("prepareController with isSelectableCurrency", function(){
        moveAmountController.prepareController();
    });

    it("dropdownItemSelected", function(){
        var objSelected = {value:'IND'};
        moveAmountController.dropdownItemSelected(objSelected);
    });


});
